/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package transformations;

import com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.jdom2.Document;
import org.jdom2.Element;


public class GenerationAutomatiqueXSLT {

    public GenerationAutomatiqueXSLT(String requete) {
        String[] criteres = requete.split("?");

        org.jdom2.Document document = new Document();
        Element xslStylesheet = new Element("xsl:stylesheet");
        xslStylesheet.setAttribute("xmlns:xsl", "http://www.w3.org/1999/XSL/Transform");
        xslStylesheet.setAttribute("version", "1.0");
        Element xslOutput = new Element("xsl:output");
        document.addContent(xslStylesheet);
        xslOutput.setAttribute("method", "html");
        
        Element xslTemplate=new Element("xsl:template");
        xslTemplate.setAttribute("match", "/emploisdutemps");
        document.addContent(xslTemplate);
        
        Element html=new Element("html");
        document.addContent(html);
        
        Element head=new Element("head");
        html.addContent(head);
        
        Element title=new Element("title");
        title.setText("emploi du temps ");
        head.addContent(title);
        
        Element body=new Element("body");
        document.addContent(body);
        
        Element h1=new Element("h1");
        h1.setText("parcours "+criteres[0]);
        body.addContent(h1);
        Element table=new Element("table");
        body.addContent(table);
        
        Element tr=new Element("tr");
        table.addContent(tr);
        
        for(int i=1;i<criteres.length;i++){
            Element th=new Element("th");
            th.setText(criteres[i]);
            tr.addContent(th);
        }
        
        
        
        //document.

    }
}
